class CartItem

  attr_reader :product_id, :quantity

  def initialize(product_id,quantity=1)
    @product_id = product_id
    @quantity = quantity
  end

  def set_quantity(quantity=1)
    @quantity = quantity
  end

  def increment_quantity(quantity=1)
    @quantity += quantity
  end

  def name
    Product.find(@product_id).name
  end

  def price
    Product.find(@product_id).retail_price
  end
  
  def total_price
    self.price * @quantity
  end
end